<template>
	<view class="page">
		<view class="flex-center margin-top150">
			<image class="img-160" style="border-radius: 50%;" src="../../static/image/logo.jpg" mode=""></image>
		</view>
		<view class="flex-column margin-top30">
			<view class="input-item-view flex-center margin-top30">
				<input type="text" v-model="form.account" class="input-item11" placeholder="请输入账号" />
			</view>
			<view class="input-item-view flex-center margin-top30">
				<input type="text" v-model="form.password" class="input-item11" placeholder="请输入密码" />
			</view>
		</view>
		<view class="flex-center padding-20 color-fff fontSize-16 btn50-307EEC239FFC-15ffffff margin-top150"
			style="border-radius: 50rpx;flex: 1;height: 60rpx;" @click="submitLogin">
			登录
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				form: {
					account:'appAdmin',
					password:'app@2024'
				}
			};
		},
		methods: {
			submitLogin() {
				this.$http.post(this.$api.login, {
					account: this.form.account,
					grantType:'password',
					password: this.form.password,
				},{}).then(res => {
					console.log(res, 'rrr');
					if (res.code == 0) {
						uni.setStorageSync('userinfo', res.data)
						uni.setStorageSync('token', res.data.token)
						uni.redirectTo({
							url: '/pages/index/index'
						})
						// if (!res.data.userinfo.openid) {
						// 	uni.navigateTo({
						// 		url:'/pages/login/gongzhonghao'
						// 	})
						// } else {
						// 	uni.switchTab({
						// 		url:'/pages/index/index'
						// 	})
						// }
					}
				})
			}
		},
	}
</script>

<style lang="scss" scoped>
	.input-item11 {
		flex: 1;
		padding: 0 40rpx;
		color: #000000;
	}

	.input-item-view {
		height: 100rpx;
		background: #F7F7F7;
		border-radius: 50rpx;
	}

	.page {
		padding: 30rpx;
		min-height: 100vh;
		background-color: #ffffff !important;
	}
</style>